class Solution {
public:
    bool repeatedSubstringPattern(string s) {
        for(int i = 1; i <= s.length() / 2; ++i){
            string substr = s.substr(0, i);
            
            if(s.length() % substr.length() != 0){
                continue;
            } else {
                string temp = "";
                for(int j = 0; j < s.length() / substr.length(); ++j){
                    temp += substr;
                }

                if(temp == s){
                    return true;
                }
            }
        }

        return false;
    }
};